﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LogManager.Base.Data;
using LogManager.Base;
using LogManager.Windows.Events;

namespace LogManager.Windows.Data
{
    public class WindowsEventBuilder<T> : IEventBuilder<T> where T:IEvent
    {
        public T Build(ILog log,IEvent e, string eventType, IDictionary<string, object> properties)
        {
            if (eventType != "Undefined")
            {
                if (eventType == (typeof(WebBaseErrorEvent).GetCustomAttributes(typeof(EventType), false).SingleOrDefault() as EventType).Type)
                {
                    e = new WebBaseErrorEvent(e)
                    {

                    };
                }
                else if (eventType == (typeof(WebRequestErrorEvent).GetCustomAttributes(typeof(EventType), false).SingleOrDefault() as EventType).Type)
                {
                    e = new WebRequestErrorEvent(e)
                    {
                        StackTrace = "testStack",
                        Exception = "testException",
                    };
                }
            }

            return (T)e;
        }
    }
}
